package com.yilin.medical.utils;
 
/****************************
 * 创建时间：2014-6-9 上午10:56:02  
 * 项目名称：JxZhagen  
 * @authort  tangmingyu
 * @version 1.0   
 * @since JDK 1.7.0_15
 * 文件名称：UriUtil.java  
 * 类说明：  
 ****************************/


	

	import java.io.File;
import java.net.URLDecoder;

import android.content.Context;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.net.Uri;

	public class UriUtil {
		
		@SuppressWarnings("deprecation")
		public static  String CheckUri(String localpath){
			
			return   URLDecoder.decode(Uri.fromFile(new File(localpath))
					.toString());
		}
		
		//初始化imageLoader
		public static void initImageLoader(Context context) {
//			DisplayImageOptions defaultOptions = new DisplayImageOptions.Builder()
//					.showImageOnLoading(R.drawable.newhead)
//					.showImageForEmptyUri(R.drawable.newhead)
//					.showImageOnFail(R.drawable.newhead)
//					.cacheInMemory(true).cacheOnDisc(true).build();
//			ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(
//					context).defaultDisplayImageOptions(defaultOptions)
//					.threadPriority(Thread.NORM_PRIORITY - 2)
//					.denyCacheImageMultipleSizesInMemory()
//					.discCacheFileNameGenerator(new Md5FileNameGenerator())
//					.tasksProcessingOrder(QueueProcessingType.LIFO).build();
//			ImageLoader.getInstance().init(config);

		}
		public static boolean isNetworkAvailable(Context context) {

			ConnectivityManager connManager = (ConnectivityManager) context
					.getSystemService(Context.CONNECTIVITY_SERVICE);
			NetworkInfo info = connManager.getActiveNetworkInfo();

			if (info != null && info.isConnectedOrConnecting()) {

				return true;
			}

			return false;
		}
	}

  